<span page-title ng-model="contentView">{{ 'Filters for Content View:' | translate }} {{ contentView.name }}</span>

<div data-extend-template="layouts/partials/table.html">
  <div data-block="list-actions">
    <button type="button" class="btn btn-default"
            ng-hide="denied('edit_content_views', contentView) || !stateIncludes('content-view.yum')"
            ui-sref="content-view.yum.filters.new">
      <span translate>New Filter</span>
    </button>
    <button type="button" class="btn btn-default"
            ng-hide="denied('edit_content_views', contentView) || stateIncludes('content-view.yum')"
            ui-sref="content-view.docker.filters.new">
      <span translate>New Filter</span>
    </button>
    <button type="button" class="btn btn-default"
            ng-hide="denied('edit_content_views', contentView)"
            ng-disabled="table.numSelected === 0"
            ng-click="removeFilters()">
      <span translate>Remove Selected</span>
    </button>
  </div>

  <span data-block="no-rows-message" translate>
    You currently don't have any Filters included in this Content View, you can add a new Filter by using the button on the right.
  </span>

  <span data-block="no-search-results-message" translate>
    Your search returned zero Filters.
  </span>

  <div data-block="table">
    <table class="table table-striped table-bordered" ng-class="{'table-mask': table.working}">

      <thead>
        <tr bst-table-head row-select>
          <th bst-table-column><span translate>Name</span></th>
          <th bst-table-column><span translate>Description</span></th>
          <th bst-table-column><span translate>Updated</span></th>
          <th bst-table-column><span translate>Content Type</span></th>
          <th bst-table-column><span translate>Inclusion Type</span></th>
        </tr>
      </thead>

      <tbody>
        <tr bst-table-row ng-repeat="filter in table.rows" row-select="filter">
          <td bst-table-cell>
            <a ng-if="filter.type === 'erratum' && !filter.rules[0].types"
               ui-sref="content-view.yum.filter.erratum.list({filterId: filter.id})">
              {{ filter.name }}
            </a>
            <a ng-if="filter.type === 'erratum' && filter.rules[0].types"
               ui-sref="content-view.yum.filter.erratum.dateType({filterId: filter.id})">
              {{ filter.name }}
            </a>
            <a ng-if="filter.type === 'rpm'"
               ui-sref="content-view.yum.filter.rpm.details({filterId: filter.id})">
              {{ filter.name }}
            </a>
            <a ng-if="filter.type === 'modulemd'"
               ui-sref="content-view.yum.filter.module-stream.list({filterId: filter.id})">
              {{ filter.name }}
            </a>
            <a ng-if="filter.type === 'package_group'"
               ui-sref="content-view.yum.filter.package_group.list({filterId: filter.id})">
              {{ filter.name }}
            </a>
            <a ng-if="filter.type === 'docker'"
               ui-sref="content-view.docker.filter.tag.details({filterId: filter.id})">
              {{ filter.name }}
            </a>
          </td>
          <td bst-table-cell>{{ filter.description }}</td>
          <td bst-table-cell><short-date-time date="filter.updated_at" /></td>
          <td bst-table-cell>
            {{ filter.type | filterContentType }}
            <span ng-if="filter.type === 'erratum' && filter.rules[0].types">{{ '- Date and Type' | translate }}</span>
          </td>
          <td bst-table-cell>{{ filter.inclusion | filterType }}</td>
        </tr>
      </tbody>

    </table>
  </div>

</div>
